let ua = navigator.userAgent;
export let ipad = /(iPad).*OS\s([\d_]+)/.test(ua);
export let isIphone = !ipad && /(iPhone\sOS)\s([\d_]+)/.test(ua);
export let isAndroid = /(Android)\s+([\d.]+)/.test(ua);
export let isMobile = isIphone || isAndroid;
export let isWechat = ua.toLowerCase().match(/MicroMessenger/i) == "micromessenger";
/**
 * @param {string} path
 * @returns {Boolean}
 */
export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path);
}

export function isArray(value) {
  if (typeof Array.isArray === "function") {
    return Array.isArray(value);
  } else {
    return Object.prototype.toString.call(value) === "[object Array]";
  }
}
export function isString(value) {
  return typeof value == "string";
}

export function isWeiXin() {
  //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息，这个属性可以用来判断浏览器类型
  var ua = window.navigator.userAgent.toLowerCase();
  //通过正则表达式匹配ua中是否含有MicroMessenger字符串
  if (ua.match(/MicroMessenger/i) == "micromessenger") {
    return true;
  } else {
    return false;
  }
}